<?php
	if(!isset($_REQUEST['ajax'])){ $_REQUEST['ajax'] = "";}
	if($_REQUEST['ajax']!=true) include 'header.tpl.php';
?>
	<div class="row">
		<div class="col-lg-12">
			<ul class="shortcut-buttons-set">
				<li>
					<a class="shortcut-button" href='#finance_line'><span>
					<i class="aicon-task_list"></i>
					<?php echo $this->language['list'];?></span></a>
				</li>
			</ul>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-6">
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-list"></i> <?php echo $this->language['bussiness_list'];?></div>
				</div>
				<div class="panel-body">
					<table class="table table-hover table-condensed">
						<thead>
							<tr>
								<th width='30px'>#</th>
								<th><?php echo $this->language['bussiness_name'];?></th>
								<th width='70px'><?php echo $this->language['bussiness_prefix'];?></th>
								<th><?php echo $this->language['note'];?></th>
							</tr>
						</thead>
						<tbody>
							<?php if(isset($this->line_list)){
								$STT = 0;
								foreach($this->line_list as $row){ $STT++;?>
							<tr>
								<td><?php echo $STT;?></td>
								<td><a href='#finance_line_view/lid=<?php echo $row['line_id'];?>'><?php echo $row['line_name'];?></a></td>
								<td><?php echo $row['line_prefix'];?></td>
								<td><?php echo $row['line_description'];?></td>
							</tr>
							<?php }} ?>
						</tbody>
						<?php if(isset($this->tfoot)) echo $this->tfoot;?>
					</table>
				</div>
			</div>
		</div>
		<div class="col-lg-6">
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-cog"></i> <?php echo $this->language['bussiness_create'];?></div>
				</div>
				<div class="panel-body">
					<?php if(check_permission('bussiness_edit')){ ?>
					<form action="javascript:createLine();" class="form-horizontal">
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['bussiness_name'];?></label>
							<div class="col-lg-8">
								<input type="text" class="form-control" id="line_name" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['bussiness_prefix'];?></label>
							<div class="col-lg-8">
							<input type="text" class="form-control" id="line_prefix" placeholder="LED,WEB,GAME,...">
							</div>
						</div>
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['note'];?></label>
							<div class="col-lg-8">
							<textarea id="line_desc" class="form-control" rows="3"></textarea>
							</div>
						</div>
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['bussiness_leader'];?></label>
							<div class="col-lg-8">
								<select id='uynhiem' class='form-control'>
									<?php foreach($_SESSION['room_data'] as $room):?>
									<optgroup label="<?php echo $room['room_name'];?>">
										<?php foreach($room['users'] as $user):?>
										<option value="<?php echo $user['user_id'];?>"><?php echo $user['user_fullname'];?></option>
										<?php endforeach;?>
									</optgroup>
									<?php endforeach;?>
								</select>
							</div>
						</div>
						<div class="form-group">
							<div class="col-lg-offset-4 col-lg-8">
								<button class="btn btn-primary" type="submit"><?php echo $this->language['accept'];?></button>
							</div>
						</div>
					</form>
					<?php }else{ ?>
					<div class="alert alert-danger"><?php echo $this->language['not_permission'];?></div>
					<?php } ?>
				</div>
			</div>
		</div>
	</div>
<?php if(isset($this->breadcrumb) && isset($this->title_header)):?>
	<script type="text/javascript">
		$(function() {
			$("#title-header").text('<?php echo $this->title_header;?>');
			$("#breadcrumb").html('<?php echo build_breadcrumb($this->breadcrumb);?>');
		});
	</script>
<?php endif;?>
<?php
	if($_REQUEST['ajax']!=true) include 'footer.tpl.php';
?>